}
if (!babelData_.ignoreVersionMismatch_ && babelVersion_ != VERSION) {
- VersionMismatch vm(0, babelVersion_, QString(VERSION));
+ VersionMismatch vm(nullptr, babelVersion_, QString(VERSION));
vm.exec();
babelData_.ignoreVersionMismatch_ = vm.neverAgain();
// Called every time, when a menu entry of the language menu is called
void MainWindow::slotLanguageChanged(QAction* action)
{
- if (0 != action) {
+ if (nullptr != action) {
// load the language dependant on the action content.
loadLanguage(action->data().toString());
}
void MainWindow::changeEvent(QEvent* event)
{
- if (0 != event) {
+ if (nullptr != event) {
switch (event->type()) {
// This event is sent if a translator is loaded.
case QEvent::LanguageChange:
}
QStringList userList =
- QFileDialog::getOpenFileNames(0, tr("Select one or more input files"),
+ QFileDialog::getOpenFileNames(nullptr, tr("Select one or more input files"),
startFile,
filterForFormat(idx));
if (!userList.empty()) {
}
QString str =
- QFileDialog::getSaveFileName(0, tr("Output File Name"),
+ QFileDialog::getSaveFileName(nullptr, tr("Output File Name"),
startFile,
filterForFormat(idx));
if (str.length() != 0) {
void MainWindow::loadFormats()
{
if (!FormatLoad().getFormats(formatList_)) {
- QMessageBox::information(0, QString(appName),
+ QMessageBox::information(nullptr, QString(appName),
tr("Error reading format configuration. "
"Check that the backend program \"gpsbabel\" is properly installed "
"and is in the current PATH\n\n"
inputDeviceFormatIndices().empty() ||
outputFileFormatIndices().empty() ||
outputDeviceFormatIndices().empty()) {
- QMessageBox::information(0, QString(appName),
+ QMessageBox::information(nullptr, QString(appName),
tr("Some file/device formats were not found during initialization. "
"Check that the backend program \"gpsbabel\" is properly installed "
"and is in the current PATH\n\n"
int fidx = currentComboFormatIndex(ui_.inputFormatCombo);
if (formatList_[fidx].getInputOptionsRef()->empty()) {
QMessageBox::information
- (0, appName,
+ (nullptr, appName,
tr("There are no input options for format \"%1\"").arg(formatList_[fidx].getDescription()));
} else {
- OptionsDlg optionDlg(0,
+ OptionsDlg optionDlg(nullptr,
formatList_[fidx].getName(),
formatList_[fidx].getInputOptionsRef(),
formatList_[fidx].getHtml());
int fidx = currentComboFormatIndex(ui_.outputFormatCombo);
if (formatList_[fidx].getOutputOptionsRef()->empty()) {
QMessageBox::information
- (0, appName,
+ (nullptr, appName,
tr("There are no output options for format \"%1\"").arg(formatList_[fidx].getDescription()));
} else {
- OptionsDlg optionDlg(0,
+ OptionsDlg optionDlg(nullptr,
formatList_[fidx].getName(),
formatList_[fidx].getOutputOptionsRef(),
formatList_[fidx].getHtml());
if (!((ui_.xlateWayPtsCk->isChecked() && ui_.xlateWayPtsCk->isEnabled()) ||
(ui_.xlateRoutesCk->isChecked() && ui_.xlateRoutesCk->isEnabled()) ||
(ui_.xlateTracksCk->isChecked() && ui_.xlateTracksCk->isEnabled()))) {
- QMessageBox::information(0, QString(appName), tr("No valid waypoints/routes/tracks translation specified"));
+ QMessageBox::information(nullptr, QString(appName), tr("No valid waypoints/routes/tracks translation specified"));
return false;
}
if ((babelData_.inputType_ == BabelData::fileType_) &&
(babelData_.inputFileNames_.empty())) {
- QMessageBox::information(0, QString(appName), tr("No input file specified"));
+ QMessageBox::information(nullptr, QString(appName), tr("No input file specified"));
return false;
}
if (babelData_.outputType_ == BabelData::noType_ && babelData_.previewGmap_ == true) {
}
if (babelData_.outputType_ == BabelData::noType_ && babelData_.previewGmap_ == false) {
- QMessageBox::information(0, QString(appName), tr("No valid output specified"));
+ QMessageBox::information(nullptr, QString(appName), tr("No valid output specified"));
return false;
} else if (babelData_.outputType_ == BabelData::fileType_ &&
babelData_.outputFileName_.length() == 0) {
- QMessageBox::information(0, QString(appName), tr("No output file specified"));
+ QMessageBox::information(nullptr, QString(appName), tr("No output file specified"));
return false;
}
return true;
bool MainWindow::runGpsbabel(const QStringList& args, QString& errorString,
QString& outputString)
{
- QProcess* proc = new QProcess(0);
+ QProcess* proc = new QProcess(nullptr);
QString name = "gpsbabel";
proc->start(name, args);
- ProcessWaitDialog* waitDlg = new ProcessWaitDialog(0, proc);
+ ProcessWaitDialog* waitDlg = new ProcessWaitDialog(nullptr, proc);
if (proc->state() == QProcess::NotRunning) {
errorString = QString(tr("Process \"%1\" did not start")).arg(name);
ui_.outputWindow->appendPlainText(tr("Translation successful"));
if (babelData_.previewGmap_) {
this->hide();
- GMapDialog dlg(0, tempName, babelData_.debugLevel_ >=1 ? ui_.outputWindow : 0);
+ GMapDialog dlg(nullptr, tempName, babelData_.debugLevel_ >=1 ? ui_.outputWindow : nullptr);
dlg.show();
dlg.exec();
QFile(tempName).remove();
QDateTime now = QDateTime::currentDateTime();
if ((babelData_.runCount_ == 1) ||
((babelData_.runCount_ > 5) && (babelData_.donateSplashed_.daysTo(now) > 30))) {
- Donate donate(0);
+ Donate donate(nullptr);
if (babelData_.donateSplashed_.date() == QDate(2010,1,1)) {
donate.showNever(false);
}
}
saveSettings();
delete upgrade;
- upgrade = 0;
+ upgrade = nullptr;
qApp->exit(0);
}
//------------------------------------------------------------------------
void MainWindow::moreOptionButtonClicked()
{
- AdvDlg advDlg(0, babelData_.synthShortNames_,
+ AdvDlg advDlg(nullptr, babelData_.synthShortNames_,
babelData_.previewGmap_, babelData_.debugLevel_);
connect(advDlg.formatButton(), SIGNAL(clicked()),
this, SLOT(resetFormatDefaults()));
//------------------------------------------------------------------------
void MainWindow::aboutActionX()
{
- AboutDlg aboutDlg(0, babelVersion_, QString(appName) + QString(" " VERSION), babelData_.installationUuid_);
+ AboutDlg aboutDlg(nullptr, babelVersion_, QString(appName) + QString(" " VERSION), babelData_.installationUuid_);
aboutDlg.setWindowTitle(tr("About %1").arg(appName));
aboutDlg.exec();
}
//------------------------------------------------------------------------
void MainWindow::preferencesActionX()
{
- Preferences preferences(0, formatList_, babelData_);
+ Preferences preferences(nullptr, formatList_, babelData_);
preferences.exec();
// We may have changed the list of displayed formats. Resynchronize.
//------------------------------------------------------------------------
void MainWindow::filtersClicked()
{
- FilterDialog dlg(0, filterData_);
+ FilterDialog dlg(nullptr, filterData_);
dlg.runDialog();
updateFilterStatus();
}
}
}
}
- return 0;
+ return nullptr;
}
UpgradeCheck::UpgradeCheck(QWidget* parent, QList<Format>& formatList,
BabelData& bd) :
QObject(parent),
- manager_(0),
- replyId_(0),
+ manager_(nullptr),
+ replyId_(nullptr),
upgradeUrl_(QUrl("http://www.gpsbabel.org/upgrade_check.html")),
formatList_(formatList),
updateStatus_(updateUnknown),
{
if (replyId_) {
replyId_->abort();
- replyId_ = 0;
+ replyId_ = nullptr;
}
if (manager_) {
delete manager_;
- manager_ = 0;
+ manager_ = nullptr;
}
}
void UpgradeCheck::httpRequestFinished(QNetworkReply* reply)
{
- if (reply == 0) {
+ if (reply == nullptr) {
babelData_.upgradeErrors_++;
return;
} else if (reply != replyId_) {
- QMessageBox::information(0, tr("HTTP"),
+ QMessageBox::information(nullptr, tr("HTTP"),
tr("Unexpected reply."));
} else if (reply->error() != QNetworkReply::NoError) {
babelData_.upgradeErrors_++;
- QMessageBox::information(0, tr("HTTP"),
+ QMessageBox::information(nullptr, tr("HTTP"),
tr("Download failed: %1.")
.arg(reply->errorString()));
- replyId_ = 0;
+ replyId_ = nullptr;
reply->deleteLater();
return;
}
// Change the url for the next update check.
// TOODO: kick off another update check.
upgradeUrl_ = redirectUrl;
- replyId_ = 0;
+ replyId_ = nullptr;
reply->deleteLater();
return;
}
}
if (statusCode != 200) {
QVariant reason = reply->attribute(QNetworkRequest::HttpReasonPhraseAttribute);
- QMessageBox::information(0, tr("HTTP"),
+ QMessageBox::information(nullptr, tr("HTTP"),
tr("Download failed: %1: %2.")
.arg(statusCode.toInt())
.arg(reason.toString()));
- replyId_ = 0;
+ replyId_ = nullptr;
reply->deleteLater();
return;
}
QString error_text;
// This shouldn't ever be seen by a user.
if (!document.setContent(oresponse, &error_text, &line)) {
- QMessageBox::critical(0, tr("Error"),
+ QMessageBox::critical(nullptr, tr("Error"),
tr("Invalid return data at line %1: %2.")
.arg(line)
.arg(error_text));
babelData_.upgradeErrors_++;
- replyId_ = 0;
+ replyId_ = nullptr;
reply->deleteLater();
return;
}
for (int i = 0; i < formatList_.size(); i++) {
formatList_[i].zeroUseCounts();
}
- replyId_ = 0;
+ replyId_ = nullptr;
reply->deleteLater();
}